<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>足迹</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<link href="../../css/mui.css" rel="stylesheet"/>
	<link href="../../css/mui.min.css" rel="stylesheet"/>
	<link href="../../css/mui-icons-extra.css" rel="stylesheet"/>
	<link href="../../css/app.css" rel="stylesheet"/>
	<style type="text/css">
	</style>
</head>
<body>
	<!-- 头部HEADER -->
	<header class="app-header">
		<span onclick="jumpToIndex()">最新</span>
		&nbsp; &nbsp; 
		<b>足迹</b>
	</header>
	<!-- 头部HEADER -->
	
	<!-- 首页视频布局 -->
	<div class="app-video-bg" id="refresh">
	</div>
	<!-- 没有数据 -->
	<p id="nodata"></p>
	<br><br>
	<!-- <textarea id="vtmp" style="width:100%;"></textarea> -->
	<!-- 首页视频布局 -->
	
	<!-- 底部菜单 -->
	<nav class="mui-bar mui-bar-tab">
		<a class="mui-tab-item mui-active" onclick="jumpToIndex()">
			<span class="mui-icon mui-icon-home"></span>
			<span class="mui-tab-label">首页</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToMarket()">
			<span class="mui-icon mui-icon-download"></span>
			<span class="mui-tab-label">库</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToReward()">
			<span class="mui-icon mui-icon-spinner-cycle"></span>
			<span class="mui-tab-label">奖励</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToMy()">
			<span class="mui-icon mui-icon-contact"></span>
			<span class="mui-tab-label">我的</span>
		</a>
	</nav>
	<!-- 底部菜单 -->
</body>
</html>


<script src="../../js/mui.js"></script>
<script src="../../js/app.js"></script>
<script src="../../js/views/view.js"></script>
<script type="text/javascript">
	mui.init({
		//下拉、上拉刷新
        pullRefresh: {
            container: "#refresh",
            up: { //上拉加载
                height: 500, 
                callback: async function () { 
					jumpToIndex();
                }
            }
        }
    });
	//自动加载
	mui.plusReady(function () {
		(function($, owner) {
			getIndex(); 
		}(mui, window.app = {}));
	});
	//获取列表
	function getIndex(){
		var w = document.documentElement.clientWidth; //屏幕宽度
		var h = document.documentElement.clientHeight; //屏幕高度
		var resList = getIndexCache(); //数据缓存
		var list = resList.list;
		// mui("#vtmp")[0].innerHTML = list[0].localLink;
		var h = '';
		if (list.length==0) {
			h = '<button type="button" class="mui-btn mui-btn-block noDataBtn">没有历史数据</button>';
			mui("#refresh")[0].innerHTML = h;
			mui.toast('没有历史数据',{ 
				duration:'long', type:'div',
			});
			return
		}
		var vs = list;
		for (var i=0;i<vs.length;i++) {
			var vHeight = Math.round(w / 2 * vs[i].videoRatio);
			var vTitle = getStrLimitNum(vs[i].videoTitle,8); //显示有限字数
			h += '<div class="app-video-history" style="height:'+vHeight+'px;float:left;" onclick="jumpToIndexOne('+vs[i].videoId+')">';
			h += '<video poster="'+vs[i].videoImg+'" name="media" height="'+vHeight+'" preload="auto" class="app-video-history-tag"><source src="'+vs[i].videoLink+'" type="video/mp4"></video>';
			h += '<div class="app-video-title app-shadow">'+vTitle+'</div>';
			h += '<div class="app-video-menu" style="margin-top:50px;">';
			// 点赞图标和数字
			if (vs[i].zanUser==0) {
				h += '<span class="mui-icon-extra mui-icon-extra-heart-filled app-video-grey app-shadow"></span>';
			} else {
				h += '<span class="mui-icon-extra mui-icon-extra-heart-filled app-heart-light app-shadow"></span>';
			}
			h += '<div class="app-video-grey app-shadow">'+vs[i].zanTotal+'</div>';
			// h += '<div style="height: 8px;"></div>';
			// h += '<span class="mui-icon mui-icon-chat app-video-grey"></span>';
			// h += '<span class="mui-icon mui-icon-starhalf app-video-grey app-shadow"></span>';
			// 收藏图标和数字
			if (vs[i].collectUser==0) {
				h += '<span class="mui-icon mui-icon-starhalf app-video-grey app-shadow"></span>';
			} else {
				h += '<span class="mui-icon mui-icon-starhalf app-heart-light app-shadow"></span>';
			}
			h += '<div class="app-video-grey app-shadow">'+vs[i].collectTotal+'</div>';
			h += '</div>';
			h += '</div>';
		}
		if (h=='') {
			h = '<button type="button" class="mui-btn mui-btn-block noDataBtn">没有历史数据</button>';
			mui("#refresh")[0].innerHTML = h;
			mui.toast('没有历史数据',{ 
				duration:'long', type:'div',
			});
			return
		}
		mui("#refresh")[0].innerHTML = h;
	}
	//获取数据缓存
	function getIndexCache(){
		var resList = cacheGet(indexList);
		if (!resList) {
			var list = new Array(),  //数据数组
				idstring = ''; //ID字符串集合
			return {
				// 数据数组
				list: list,
				// ID集合
				ids: idstring
			};
		}
		return resList;
	}
</script>